from utils.sql.app.ganger import get_ganger_list, insert_ganger, update_info, delede_ganger, nowaday_ganger, get_ganger


# 查询工头列表
async def ganger_list(query: str, current, userid: str):
    info = get_ganger_list(userid, query, current)
    return info


# 获取单个工头信息
async def ganger_one(gangerid, userid):
    info = get_ganger(gangerid, userid)
    return info


# 添加工头
async def add_ganger(data, user_id):
    ganger = insert_ganger(data, user_id)
    return ganger


# 修改工头信息
async def update_ganger(data, user_id):
    ganger = update_info(data, user_id)
    return ganger


# 删除工头
async def remove_ganger(id, dedaults, user_id: str):
    ganger = delede_ganger(id, dedaults, user_id)
    return ganger


# 工头设置为当前
async def current_ganger(ganger_id, user_id):
    ganger = nowaday_ganger(ganger_id, user_id)
    return ganger
